
project(SoftRenderer)

# FreeImage
# set(FreeImage_DIR "D:/OpenCASCADE-7.5.0-vc14-64/freeimage-3.17.0-vc14-64/lib/cmake")
# find_package(FreeImage REQUIRED COMPONENTS FreeImage)

# Boost::algorithm
find_package(Boost REQUIRED COMPONENTS locale)

# OpenMP
# find_package(OpenMP)
message("OpenMP: " ${OpenMP_FOUND})

if(OpenMP_FOUND)
    message(STATUS "found openmp") 
    #set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS}, ${OPENMP_C_FLAGS})
    #set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}, ${OPENMP_CXX_FLAGS})
else()
    # message(FATAL_ERROR "openmp not found!")
    message(STATUS "openmp not found!")
endif()


# 定义 lib
add_library(${PROJECT_NAME} STATIC)

# lib：添加源文件
target_sources(${PROJECT_NAME}
    PRIVATE
    Matrix4.cpp
    Vector3.cpp
    Quaternion.cpp
    Object3D.cpp
    Mesh.cpp
    Geometry.cpp
    MeshBasicMaterial.cpp
    Color3.cpp Color4.cpp
    XTBinLoader.cpp
    Renderer.cpp
    Vector2.cpp
    PerspectiveCamera.cpp
    STLLoader.cpp
    ParserBuffer.cpp
    OrthographicCamera.cpp
    Camera.cpp
    Box3.cpp
    Loader.cpp)

# lib：添加头文件路径
target_include_directories(${PROJECT_NAME}
    PUBLIC
        .
    PRIVATE
        ${Boost_INCLUDE_DIRS}
#        ${OpenMP_CXX_INCLUDE_DIRS}
)

# lib：链接文件
target_link_libraries(${PROJECT_NAME}
    # PUBLIC
    #     FreeImage::FreeImage
    PRIVATE
        Boost::locale
#        ${OpenMP_CXX_LIBRARIES}
)

#target_compile_options(${PROJECT_NAME} PUBLIC ${OpenMP_CXX_FLAGS})

